import request from '@/utils/request'

// 订单结算
// cart buynow都可以使用这个
export const checkOrder = (mode, obj) => {
  return request.get('/checkout/order', {
      mode, // cart buynow
      delivery: 10, // 10快递20自提
      couponId: 0, // 优惠卷
      isUsePoints: 0, // 积分
      ...obj// 传递过来的参数对象，动态展开
  })
}

// 提交订单
// mode:buyNow=>obj{goosId,goodsNum,goodsSkuId,remark}
export const submitOrder = (mode, obj) => {
  return request.post('/checkout/submit', {
    mode,
    delivery: 10, // 快递配送
    couponId: 0,
    isUsePoints: 0,
    payType: 10, // 余额支付
    ...obj
  })
}

// 订单列表
export const getMyOrderList = (dataType, page) => {
  return request.get('/order/list', {
      dataType,
      page // list分页
  })
}
